package com.itcast.polymorphic.Demo02;

/*
创建子类对象给父类
*/
public class Test {
    public static void main(String[] args) {
        Fruit fruit=new Apple();
        zha(fruit);
        zha(new Banana());
        zha(new Orange());
    }

    public static void zha(Fruit fruit) {
        //调用子类方法
        fruit.getJuice();
        System.out.println("把汁装到杯子里面！");
    }
}
